;------------------------------------------------------------------
;Program: line/word/char counter
;function: Counts the number of characters, words, lines in a file
;------------------------------------------------------------------
													;use turbo ideal mode
		.model		small							;64k code and 64k data
		.8086										;only allow 8086 instructions
		.stack		256								;reserver 256 bytes for the stack
;----------------------------------------------------
		.data										;start the data segment
;----------------------------------------------------
convert		db		0							;data used to convert from upper to lower case
period		db		02Eh							;data holding the char count
blank		db		020h							;data holding the line count


;----------------------------------------------------
		.code										;start the code segment
;----------------------------------------------------
start:
		
		mov		ax,@data
		mov		ds,ax

keyin:
		
		mov		ah, 8
		int		21h
		
		mov		[convert],al
		cmp		al,[blank]
		je		keyout
		cmp		al,[period]
		je		keyout
		cmp		al,07Ah
		ja		keyin
		cmp		al,061h
		jae		con
		cmp		al,05Ah
		ja		keyin
		cmp		al,041h
		jb		keyin
		cmp		al,041h
		jae		keyout
		
		
		
con:

		sub		al,[blank]
		jmp		keyout
	
	
keyout:
		
		mov		dl,al
		mov		ah,2
		int 	21h
		cmp		dl,[period]
		jne		keyin

exit: 
		mov		ax,4C00h
		int		21h
		end		start